import api from "@/request/index";
import * as CONSTANTS from "@constants/index";
import * as UTILS from "@/utils/index";
import { iGetDataParams } from "./types";

export const getAlbum = async (p: iGetDataParams): Promise<[]> => {
  const {
    VAR_CHANNELID: channelId
  } = CONSTANTS;
  const params = { ...p, channelId, }
  const response = await api.queryAlbum(params);
  const { success = true, data = [] } = response
  if (success) return data;
  return [];
}

export const uploadEvents = async (p: any): Promise<[]> => {
  const {
    VAR_CHANNELID: channelId,
  } = CONSTANTS;
  const params = {
    ...p, channelId,
    create_time: UTILS.getFormatDate(),
    os: UTILS.getSystem()
  }
  const response = await api.uploadEventTracks(params);
  const { success = true, data = [] } = response
  if (success) return data;
  return [];
}